Skip to content

Conversation

@joshuabaird
Copy link
Collaborator

@joshuabaird joshuabaird commented Oct 29, 2025

Adds arm64 make targets for building arm64 images locally.

Example builds of fluent-operator:

arm64:

❯ make build-arm64
docker build --platform=linux/arm64 -f cmd/fluent-manager/Dockerfile . -t kubesphere/fluent-operator:v3.5.0
[+] Building 1.4s (18/18) FINISHED                                                                                                                                                                                                                              
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                       0.2s
 => => transferring dockerfile: 37B                                                                                                                                                                                                                        0.1s
 => [internal] load .dockerignore                                                                                                                                                                                                                          0.0s
 => => transferring context: 35B                                                                                                                                                                                                                           0.0s
 => [internal] load metadata for docker.io/kubesphere/distroless-static:nonroot                                                                                                                                                                            1.1s
 => [internal] load metadata for docker.io/library/golang:1.24.5-alpine3.21                                                                                                                                                                                1.0s
 => [builder  1/10] FROM docker.io/library/golang:1.24.5-alpine3.21@sha256:6edc20586dd08dacad538c1f09984bc2aa61720be59056cf75429691f294d731                                                                                                                0.0s
 => [stage-1 1/3] FROM docker.io/kubesphere/distroless-static:nonroot@sha256:6a3500b086c2856fbc189f5d11351bdbcf7c4dc5673c2b6070aac9d607da90d7                                                                                                              0.0s
 => [internal] load build context                                                                                                                                                                                                                          0.0s
 => => transferring context: 23.33kB                                                                                                                                                                                                                       0.0s
 => CACHED [builder  2/10] WORKDIR /workspace                                                                                                                                                                                                              0.0s
 => CACHED [builder  3/10] COPY go.mod go.mod                                                                                                                                                                                                              0.0s
 => CACHED [builder  4/10] COPY go.sum go.sum                                                                                                                                                                                                              0.0s
 => CACHED [builder  5/10] RUN go mod download                                                                                                                                                                                                             0.0s
 => CACHED [builder  6/10] COPY cmd/fluent-manager/main.go main.go                                                                                                                                                                                         0.0s
 => CACHED [builder  7/10] COPY apis apis/                                                                                                                                                                                                                 0.0s
 => CACHED [builder  8/10] COPY controllers controllers/                                                                                                                                                                                                   0.0s
 => CACHED [builder  9/10] COPY pkg pkg/                                                                                                                                                                                                                   0.0s
 => CACHED [builder 10/10] RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GO111MODULE=on go build -a -o manager main.go                                                                                                                                         0.0s
 => CACHED [stage-1 2/3] COPY --from=builder /workspace/manager .                                                                                                                                                                                          0.0s
 => exporting to image                                                                                                                                                                                                                                     0.0s
 => => exporting layers                                                                                                                                                                                                                                    0.0s
 => => writing image sha256:69aeeca020798969424364037fdca5e027bc4b09ed9ddf355733ccf1eac05066                                                                                                                                                               0.0s
 => => naming to docker.io/kubesphere/fluent-operator:v3.5.0  

amd64:

❯ make build-amd64
docker build --platform=linux/amd64 -f cmd/fluent-manager/Dockerfile . -t kubesphere/fluent-operator:v3.5.0
[+] Building 337.0s (18/18) FINISHED                                                                                                                                                                                                                            
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                       0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                          0.0s
 => => transferring context: 35B                                                                                                                                                                                                                           0.0s
 => [internal] load metadata for docker.io/kubesphere/distroless-static:nonroot                                                                                                                                                                            0.3s
 => [internal] load metadata for docker.io/library/golang:1.24.5-alpine3.21                                                                                                                                                                                0.3s
 => [builder  1/10] FROM docker.io/library/golang:1.24.5-alpine3.21@sha256:6edc20586dd08dacad538c1f09984bc2aa61720be59056cf75429691f294d731                                                                                                                0.0s
 => CACHED [stage-1 1/3] FROM docker.io/kubesphere/distroless-static:nonroot@sha256:6a3500b086c2856fbc189f5d11351bdbcf7c4dc5673c2b6070aac9d607da90d7                                                                                                       0.0s
 => [internal] load build context                                                                                                                                                                                                                          0.0s
 => => transferring context: 23.33kB                                                                                                                                                                                                                       0.0s
 => CACHED [builder  2/10] WORKDIR /workspace                                                                                                                                                                                                              0.0s
 => CACHED [builder  3/10] COPY go.mod go.mod                                                                                                                                                                                                              0.0s
 => CACHED [builder  4/10] COPY go.sum go.sum                                                                                                                                                                                                              0.0s
 => CACHED [builder  5/10] RUN go mod download                                                                                                                                                                                                             0.0s
 => CACHED [builder  6/10] COPY cmd/fluent-manager/main.go main.go                                                                                                                                                                                         0.0s
 => CACHED [builder  7/10] COPY apis apis/                                                                                                                                                                                                                 0.0s
 => CACHED [builder  8/10] COPY controllers controllers/                                                                                                                                                                                                   0.0s
 => CACHED [builder  9/10] COPY pkg pkg/                                                                                                                                                                                                                   0.0s
 => [builder 10/10] RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go                                                                                                                                              335.4s
 => [stage-1 2/3] COPY --from=builder /workspace/manager .                                                                                                                                                                                                 0.5s
 => exporting to image                                                                                                                                                                                                                                     0.2s
 => => exporting layers                                                                                                                                                                                                                                    0.2s
 => => writing image sha256:9c648fe14f110e205107400f8dab14a4a1b9151a237c73060d918690c07038b8                                                                                                                                                               0.0s
 => => naming to docker.io/kubesphere/fluent-operator:v3.5.0     

apiVersion: v1
fieldPath: metadata.namespace
image: ghcr.io/fluent/fluent-operator/fluent-operator:v3.5.0
image: ghcr.io/fluent/fluent-operator/fluent-operator:latest
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but this resets the tag to latest on master so that CI passes.

cw-Guo
cw-Guo previously approved these changes Oct 30, 2025
Signed-off-by: Josh Baird <[email protected]>
@marcofranssen marcofranssen force-pushed the chore/arm64-makefile-targets branch from 9ab9746 to e465c94 Compare October 30, 2025 09:34
Copy link
Collaborator

@marcofranssen marcofranssen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See suggestions:

  1. Some targets where copy past errors and still amd64.
  2. PHONY should be used https://makefiletutorial.com/#phony

Co-authored-by: Marco Franssen <[email protected]>
Signed-off-by: Josh Baird <[email protected]>
joshuabaird and others added 5 commits October 30, 2025 08:38
Co-authored-by: Marco Franssen <[email protected]>
Signed-off-by: Josh Baird <[email protected]>
Co-authored-by: Marco Franssen <[email protected]>
Signed-off-by: Josh Baird <[email protected]>
Co-authored-by: Marco Franssen <[email protected]>
Signed-off-by: Josh Baird <[email protected]>
Co-authored-by: Marco Franssen <[email protected]>
Signed-off-by: Josh Baird <[email protected]>
Co-authored-by: Marco Franssen <[email protected]>
Signed-off-by: Josh Baird <[email protected]>
@joshuabaird joshuabaird enabled auto-merge (squash) October 30, 2025 12:43
Makefile Outdated
docker buildx build --push --platform linux/amd64,linux/arm64 -f cmd/fluent-watcher/fluentbit/Dockerfile.debug . -t ${FB_IMG_DEBUG}

# Build all amd64 docker images
PHONY: build-amd64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should there be . PHONY instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - fixed.

Signed-off-by: Josh Baird <[email protected]>
@marcofranssen marcofranssen force-pushed the chore/arm64-makefile-targets branch 2 times, most recently from a82fa47 to 484a96a Compare November 4, 2025 16:48
Signed-off-by: Josh Baird <[email protected]>
@joshuabaird joshuabaird force-pushed the chore/arm64-makefile-targets branch from 484a96a to c16e10e Compare November 7, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants